package com.cloudknow.utils;

import android.graphics.Color;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

/**
 * Create bu wubin on .
 *
 * @description 废弃
 */
public class VerifyTime extends CountDownTimer {
    private TextView textView;
    private RelativeLayout button;

    /**
     * @param millisInFuture    The number of millis in the future from the call
     *                          to {@link #start()} until the countdown is done and {@link #onFinish()}
     *                          is called.
     * @param countDownInterval The interval along the way to receive
     *                          {@link #onTick(long)} callbacks.
     */
    public VerifyTime(RelativeLayout button, TextView textView, long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        this.textView=textView;
        this.button=button;
    }

    @Override
    public void onTick(long millisUntilFinished) {//倒计时刷新
        textView.setClickable(false);
        textView.setText(millisUntilFinished / 1000 + "s后重新获取" );
        textView.setBackgroundColor(Color.GRAY);
    }

    @Override
    public void onFinish() {//倒计时完成后的操作
        button.setVisibility(View.VISIBLE);
        textView.setVisibility(View.INVISIBLE);
    }
}

